function formatRow( $row ) {
$this->mCurrentRow = $row; # In case formatValue etc need to know
- $classArray = $this->getRowAttrs($row);
- if ( $classArray['class'] === '' ) {
- $s = Html::openElement( 'tr' );
- } else {
- $s = Html::openElement( 'tr', $classArray );
- }
+ $s = Xml::openElement( 'tr', $this->getRowAttrs($row) );
$fieldNames = $this->getFieldNames();
foreach ( $fieldNames as $field => $name ) {
$value = isset( $row->$field ) ? $row->$field : null;
* @return Associative array
*/
function getRowAttrs( $row ) {
- return array( 'class' => $this->getRowClass( $row ) );
+ $class = $this->getRowClass( $row );
+ if ( $class === '' ) {
+ // Return an empty array to avoid clutter in HTML like class=""
+ return array();
+ } else {
+ return array( 'class' => $this->getRowClass( $row ) );
+ }
}
/**